package WaiBao;

import java.util.Arrays;

public class ZhangRong {
    public static void main(String[] args) {
        String[] name = {"白敬亭(班长)", "张渚(副班长)", "小李(学习委员)", "李大伟(组织委员)", "李帅", "郦道元", "王峰", "汪峰", "笑笑", "贝贝", "夏天", "晓东",
                "李志远", "香甜", "嘟嘟", "小胖", "大虎", "小王", "张艺兴", "张三", "李四", "王五", "赵六", "黄芪", "薛宝钗", "林黛玉", "贾宝玉", "何以笙",
                "萧默", "张蓉(学生)"};//考生本人: 张蓉((学生)
        int[] age = {18, 19, 20, 19, 18, 20, 19, 21, 19, 19, 18, 18, 18, 20, 20, 19, 18, 18, 18, 18, 19, 19, 20, 20, 20, 18, 20, 18, 20, 19};//考生本人年龄:19
        double[] C1 = {67, 72, 84, 90, 79, 69, 78, 89, 80, 80, 91, 87, 85, 89, 65, 68, 99, 99, 96, 88, 92, 91, 95, 65, 75, 74, 94, 74, 88, 93};
        double[] C2 = {75, 85, 99, 76, 78, 77, 78, 69, 90, 70, 90, 77, 66, 95, 65, 65, 76, 99, 66, 98, 72, 71, 95, 86, 75, 88, 84, 64, 80, 93};
        double[] C3 = {84, 76, 84, 85, 77, 66, 78, 69, 80, 80, 93, 87, 85, 65, 65, 68, 69, 96, 96, 93, 92, 81, 65, 95, 76, 84, 73, 71, 89, 94};

        double FF ;//代表每个学生的总分
        double GG;//代表每个学生的平均分
//        for (int i = 0; i < 30; i++) {
//            FF = C1[i] + C2[i] + C3[i];
//            GG= (FF * 1.0) / 3;
//            System.out.println(name[i] + "的总分为:" + FF);
//            System.out.println(name[i] + "的平均分为:" + GG);
//        }

//        double SS = 0, KK = 0;
//        double[] get = new double[30];
//        for (int i = 0; i < 30; i++) {
//            SS = B1[i] + B2[i] + B3[i];
//            KK= (SS * 1.0) / 3;
//            get[i] = KK;
//        }
//
//        for (int i = 0; i < get.length - 1; i++) {
//            for (int j = 0; j < get.length - i - 1; j++) {
//                if (get[j] < get[j + 1]) {
//                    double tep = get[j];
//                    get[j] = get[j + 1];
//                    get[j + 1] = tep;
//                }
//            }
//        }
//        System.out.println("前十名同学的成绩为:");
//        for (int i = 0; i < 10; i++) {
//            System.out.println(get[i]);
//        }


        double X1 = 0, X2 = 0, X3 = 0;//计算每门课的平均分
        double Z1 = 0, Z2 = 0, Z3 = 0;//计算每门课标准差
        double Y1 = 0, Y2 = 0, Y3 = 0;//计算每门课中位数
        double he = 0;
        for (int i = 0; i <C1.length; i++) {
            he += C1[i];
        }
        X1 = (he * 1.0) / 30;
        System.out.println("生物化学的班级平均分为:" + X1);
        double Sum = 0;
        for (int i = 0; i < C2.length; i++) {
            Sum += C2[i];
        }
        X2 = (Sum * 1.0) / 30;
        System.out.println("微生物学的班级平均分为:" + X2);
        double sum = 0;
        for (int i = 0; i < C3.length; i++) {
            sum += C3[i];
        }
        X3 = (sum * 1.0) / 30;
        System.out.println("人体组织解剖学的班级平均分为:" + X3);



        double c1 = 0, c2 = 0, c3 = 0;
        for (int i = 0; i < C1.length; i++) {
            c1 += (C1[i] - X1) * (C1[i] - X1);
        }
        Z1 = Math.sqrt(c1*1.0/30);
        System.out.println("生物化学的班级标准差为:" + Z1);
        for (int i = 0; i < C2.length; i++) {
            c2 += (C2[i] - X2) * (C2[i] - X2);
        }
        Z2 = Math.sqrt(c2*1.0/30);
        System.out.println("微生物学的班级标准差为:" + Z2);

        for (int i = 0; i < C3.length; i++) {
            c3 += (C3[i] - X3) * (C3[i] - X3);
        }
        Z3 = Math.sqrt(c3*1.0/30);
        System.out.println("人体组织解剖学的班级标准差为:" + Z3);
//
//
//
        Arrays.sort(C1);
        Arrays.sort(C2);
        Arrays.sort(C3);
        Y1 = (C1[15] + C2[16]) * 1.0 / 2;
        Y2 = (C2[15] + C2[16]) * 1.0 / 2;
        Y3 = (C3[15] + C3[16]) * 1.0 / 2;
        System.out.println("生物化学的中位数为:" + Y1);
        System.out.println("微生物学的中位数为:" + Y2);
        System.out.println("人体组织解剖学的中位数为:" + Y3);

    }
}
